home *** CD-ROM | disk | FTP | other *** search
- Path: rcp6.elan.af.mil!rscernix!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: is getopt() ANSI and portable ?
- Date: 21 Mar 96 19:45:58 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.827437558@rscernix>
- References: <31512EC7.389F@eso.org>
- NNTP-Posting-Host: ues5.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <31512EC7.389F@eso.org> Nicolas Devillard <nDevil@eso.org> writes:
-
- >I do not want to reinvent the wheel by creating again my own
- >command line parser. I found this getopt() function being part
- >of stdlib, but I'd like to know:
- >
- >1. If it is part of the ANSI C stdlib ?
-
- It isn't.
-
- >2. If it is a portable call ?
-
- It can be implemented portably in ANSI C. Ask your archie client to
- find an implementation.
-
- >I cannot find it in the POSIX prog guide.
-
- This is your problem. My man page says:
-
- STANDARDS CONFORMANCE
- getopt(): AES, SVID2, XPG2, XPG3, XPG4, POSIX.2
-
- >The definition as given by my man page says :
- >
- >SYNOPSIS
- > #include <stdlib.h>
- >
- > int getopt(int argc, char * const *argv,
- > const char *optstring);
-
- getopt() is not a standard C function, hence it doesn't belong to
- <stdlib.h>. However, some vendors stupidly require/recommend the
- inclusion of <stdlib.h> or even <stdio.h>. Most of them declare it in
- <unistd.h>, where it actually belongs.
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-